package com.eascs.workflow.sys.user;

import com.alibaba.dubbo.config.annotation.Service;
import com.eascs.common.util.ApplicationContextUtil;
import com.eascs.site.session.SessionData;
import com.eascs.site.session.SessionProvider;
import com.eascs.web.sso.SsoUserService;
import com.eascs.web.sso.User;

@Service
public class SsoUserServiceImpl implements SsoUserService {

	private SessionProvider sessionProvider;

	@Override
	public User getUserWithValidId(String validId) {
		if (null == sessionProvider) {
			sessionProvider = ApplicationContextUtil.getBean(SessionProvider.class);
		}
		SessionData sessionData = sessionProvider.loadSessionData(validId, null);
		if (null == sessionData)
			return null;
		User user = (com.eascs.web.sso.User) sessionData.get(User.SESSION_USER_NAME);
		return user;
	}

}
